package com.corejava.training.collections.car.pre15;

public class LaptopMutable {

	// Laptop : company, model, operatingSystem, processor
	// Laptop class which is mutable, below is instance variables

	private String company;
	private String model;
	private String os;
	private double processor;

	// getters, setters
	/**
	 * @return the company
	 */
	public String getCompany() {
		return company;
	}

	/**
	 * @param company
	 *            the company to set
	 */
	public void setCompany(String company) {
		this.company = company;
	}

	/**
	 * @return the model
	 */
	public String getModel() {
		return model;
	}

	/**
	 * @param model
	 *            the model to set
	 */
	public void setModel(String model) {
		this.model = model;
	}

	/**
	 * @return the os
	 */
	public String getOs() {
		return os;
	}

	/**
	 * @param os
	 *            the os to set
	 */
	public void setOs(String os) {
		this.os = os;
	}

	/**
	 * @return the processor
	 */
	public double getProcessor() {
		return processor;
	}

	/**
	 * @param processor
	 *            the processor to set
	 */
	public void setProcessor(double processor) {
		this.processor = processor;
	}

	@Override
	public boolean equals(Object obj) {

		if (obj instanceof LaptopMutable) {

			LaptopMutable objLaptop = (LaptopMutable) obj;

			return objLaptop.getCompany().equals(this.getCompany());

		} else if (obj instanceof LaptopMutable) {

			LaptopMutable objLaptop = (LaptopMutable) obj;

			return objLaptop.getModel().equals(this.getModel());

		} else {

			return false;

		}

	}

	@Override
	public int hashCode() {

		return this.company.hashCode();

	}

} // end of class





